export type Tag = {
  name: string,
  level: number,
  parentTags: string[],
  similarTags: string[],
}

export type TagList = Tag[];

export type Tool = {
  _id: string, // ID
  name: string, // 工具标题名称
  icon: string, // 工具图标
  permalink: string, // 工具固定链接
  description: string, // 工具简介
  statistics: {
    clickCount: number
    collectionCount: number
    forwardCount: number
    likeCount: number
    showCount: number
  },
  tags: {
    id: string,
    name: string,
  }[],
  // 用户相关状态属性
  isLike?: boolean,
  isCollection?: boolean,
}
export type ToolList = Tool[];

export type UserInfo = {
  _id: string,
  name: string,
  toolLike?: string[],
  toolCollection?: string[],
  toolForward?: string[],
}

export interface ToolStateInterface {
  tag: {
    list: TagList,
    isLoaded: boolean,
  },
  tool: {
    list: ToolList
  },
  currentTool?: Tool | null,
  toolLike: string[],
  toolCollection: string[],
}

function state (): ToolStateInterface {
  return {
    tag: {
      list: [],
      isLoaded: false
    },
    tool: {
      list: []
    },
    currentTool: null,
    toolLike: [],
    toolCollection: []
  }
}

export default state
